package lab02.test34;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

public class Test34 {
    public static void main(String[] args) {
        List<String> list=new ArrayList<>() ;
        list.add("apple");
        list.add("grape");
        list.add("banana");
        list.add("pear");
        String a= Collections.max(list);
        String b= Collections.min(list);
        System.out.println("max="+a);
        System.out.println("min="+b);
        //排序
        Collections.sort(list);
        System.out.println("按首字母排序");
        for (Object o:list){
            System.out.println(o);
        }
    }
}
